METHOD:  Function::valueOf


Function.valueOf ()
 
The valueOf method returns a string which represents the source code of a function. This over-rides the Object.valueOf method. The valueOf method is usually called by JavaScript behind the scenes, but to demonstrate the output, the following code first creates a Function object called Car, and then displays the value of that function:
 
Code:
function car(make, model, year)
{this.make = make, this.model = model, this.year = year}
document.write(car.valueOf())

 
Output:
function car(make, model, year) {this.make = make, this.model = model, this.year = year
 
With the built-in Function object the valueOf method would produce the following string:
 
Output:
function Function() { [native code] }.


Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information